<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // JS单线程 idle
        // fs I/O 内存 块 ，硬盘 慢 ajax
        console.log('event-loop'); // 1
        // setTimeout () => {} 挂起
        setTimeout(() => { // 进入到任务队列 -> 属于主线程 队列结构
            // 当主线程停下来之后，轮询 event-loop task-queue
            console.log('setTimeout1'); // 2
            Promise.resolve().then(data => {
                console.log(2222);
            })
        }, 0)
        setTimeout(() => {
            console.log('setTimeout2');
        }, 0);
        Promise.resolve().then(data => {
            console.log(111);
        })
        console.log('event-loop end'); //3
    </script>
</body>

</html>